import {Component, OnInit} from '@angular/core';
import {BasePage} from '../../common/basePage';
import {ActivatedRoute} from '@angular/router';
import {NavController, ToastController} from '@ionic/angular';
import {DomSanitizer, SafeHtml} from '@angular/platform-browser';

@Component({
  selector: 'app-help-center-detail',
  templateUrl: './help-center-detail.page.html',
  styleUrls: ['./help-center-detail.page.scss'],
})
export class HelpCenterDetailPage extends BasePage implements OnInit {

  public data: any = {
    type: '',
    title: '',
    content: null
  };
  public content: SafeHtml;

  constructor(public navCtrl: NavController,
              public toastCtrl: ToastController,
              private routeInfo: ActivatedRoute,
              private sanitize: DomSanitizer
  ) {
    super(navCtrl, toastCtrl);
  }

  ngOnInit() {
    this.data = {
      ...this.routeInfo.snapshot.params,
      content: this.sanitize.bypassSecurityTrustHtml(this.routeInfo.snapshot.params['content'])
    };
  }

}
